package com.example.app2.Dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.example.app2.pojo.BookInfo;

import java.util.List;

@Dao
public interface BookDao {
   @Insert
   void insert(BookInfo... book);
   @Query("delete from bookinfo where name=:name")
   void delete(String name);
   @Query("delete from bookinfo")
   void deleteAll();
   @Update(onConflict = OnConflictStrategy.REPLACE)
   void update(BookInfo... book);
   @Query("select * from bookinfo")
   List<BookInfo> queryAll();
   @Query("select * from bookinfo where name=:name ORDER BY id DESC limit 1")
   BookInfo queryByName(String name);

}
